<%@ page import="cn.edu.swu.Item" %>
<%@ page import="java.util.List" %>
<%@ page import="cn.edu.swu.DBUtils" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en" xmlns:color="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
    <meta name="description" content="" />
    <meta name="author" content="" />
    <title>BUFF store</title>
    <!-- Favicon-->
    <link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
    <!-- Bootstrap icons-->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" />
    <!-- Core theme CSS (includes Bootstrap)-->
    <link href="css/styles.css" rel="stylesheet" />
</head>
<body>
<!-- Navigation-->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
    <div class="container px-6 px-lg-6">
        <a class="navbar-brand" >菜单栏</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
        <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav me-auto mb-2 mb-lg-0 ms-lg-4">
                <li class="nav-item"><a class="nav-link active" aria-current="page" href="./test.jsp">首页</a></li>
                <li class="nav-item"><a class="nav-link" href="./search.jsp">搜索</a></li>
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" id="navbarDropdown" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">饰品</a>
                    <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
                        <li><a class="dropdown-item" >磨损分类</a></li>
                        <li><hr class="dropdown-divider" /></li>
                        <li><a class="dropdown-item" href="#!">崭新出厂</a></li>
                        <li><a class="dropdown-item" href="#!">略有磨损</a></li>
                        <li><a class="dropdown-item" href="#!">久经沙场</a></li>
                        <li><a class="dropdown-item" href="#!">破损不堪e</a></li>
                    </ul>
                </li>
            </ul>
            <button class="btn btn-outline-dark" >
                <a class="nav-item text-decoration-none color:#fff " aria-current="page"  href='./login.html'>登 录</a>
            </button>
        </div>
    </div>
</nav>
<!-- Header-->
<header class="bg-dark py-5">
    <div class="container px-4 px-lg-5 my-5">
        <div class="text-center text-white">
            <h1 class="display-4 fw-bolder">BUFF饰品交易市场</h1>
            <p class="lead fw-normal text-white-50 mb-0">你想要的，这里都有！</p>
        </div>
    </div>
</header>
<!-- Section-->

<section class="py-5">
    <div class="container px-4 px-lg-5 mt-5">
        <div class="row gx-4 gx-lg-5 row-cols-2 row-cols-md-3 row-cols-xl-4 justify-content-center">
<%
    String sql = "SELECT * FROM aitems ORDER BY id DESC";
    List<Item> items = DBUtils.getItems(sql);
    for (int i=0; i<items.size(); i++)
    {
        Item item = items.get(i);
%>

            <div class="col mb-5">
                <div class="card h-100">
                    <!-- Product image-->

                    <img width="268px" height="268px" src="/myapp/upload/<%=item.getPics().replaceAll(",", "")%>"> </img>
                    <!-- Product details-->
                    <div class="card-body p-4">
                        <div class="text-center">
                            <!-- Product name-->
                            <h5 class="fw-bolder">
                                   <%=item.getName()%>
                            </h5>
                            <h5 class="fw-bolder"> 模板：<%=item.getTemplate()%></h5>
                            <h5 class="fw-bolder"> 磨损度：<%=item.getType()%></h5>
                            <h5 class="fw-bolder"> 价格：<%=item.getPrice()%></h5>
                            <h5 class="fw-bolder">描述：<%=item.getDescribe()%></h5>
                        </div>
                    </div>
                    <!-- Product actions-->
                    <div class="card-footer p-4 pt-0 border-top-0 bg-transparent">
                        <div class="text-center"><a class="btn btn-outline-dark mt-auto" href="#">购买</a></div>
                    </div>
                </div>
            </div>

<%
    }
%>
         </div>
</div>
</section>

<!-- Footer-->
<footer class="py-5 bg-dark">
    <div class="container"><p class="m-0 text-center text-white">by 周文铭迪</p></div>
</footer>
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="js/scripts.js"></script>
</body>
</html>
